function [ctl, expt] = make_result(CONTROL, struct, substruct, sel1, sel2, fid)
% do computation and find result for data set selections and compare stats.
% Helper function for summary analysis. 1/12/99 P. Manis

fprintf(fid, '\n');
if(isempty(strmatch('NO', substruct, 'exact'))) % substructure format...
   ctl = basic_stats(struct_extract(CONTROL, struct, substruct, sel1), 1, sprintf('Control %s.%s: ', struct, substruct), fid);
   expt = basic_stats(struct_extract(CONTROL, struct, substruct, sel2), 1, sprintf('Exptmtl %s.%s: ', struct, substruct), fid);
else % direct entry in structure
   ctl = basic_stats(struct_extract(CONTROL, struct, [], sel1), 1, sprintf('Control %s: ', struct), fid);
   expt = basic_stats(struct_extract(CONTROL, struct, [], sel2), 1, sprintf('Exptmtl %s: ', struct), fid);
end
compare_stats(ctl, expt, 1, [], fid);
